<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
    <style>
        .active {
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="box">
        {{ myName }}
        <button @click = "handleClick()">change</button>

        <div v-show="isShow">我是动态隐藏和显示的</div> 
    
        <div v-if="ifCreate">动态创建和删除</div>

        <div class="active">动态切换背景色</div>
    </div>

    <script>
        var vm = new Vue({
            el:"#box",
            data: {
                myName: "ss",
                isShow: true,
                ifCreate: true
            },
            methods: {
                handleClick() {
                    this.myName = "dsa";
                    this.isShow = !this.isShow;
                    this.isCreate = !this.isCreate
                }
            }
        })
    </script>
</body>
</html>